﻿using System.Windows;
using System.Windows.Media;

namespace GraphLight.Controls
{
    public partial class DragDropManager
    {
        private static UIElement getDropTarget(UIElement element)
        {
            DependencyObject hit = null;
            VisualTreeHelper.HitTest(element,
                target => GetAllowDrop(target)
                    ? HitTestFilterBehavior.ContinueSkipChildren
                    : HitTestFilterBehavior.ContinueSkipSelf,
                hitTestResult =>
                {
                    hit = hitTestResult.VisualHit;
                    return HitTestResultBehavior.Continue;
                },
                new PointHitTestParameters(_options.Current));
            return (UIElement)hit;
        }
    }
}